/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.base.files;

import java.io.IOException;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import model.Prover;
import view.base.TreeCollapsePanel;

/**
 *
 * @author camil
 */
public class SaveTreeXMLPanel extends view.base.files.ChooseFilePanel {

    Prover prover = null;
    public final static Logger EXCEPTIONLOGGER = Logger.getLogger("exception logger");

    public SaveTreeXMLPanel(TreeCollapsePanel tcp) {
        super();
        prover = tcp.p;
        setButtonName("Save");
    }

    /**
     * load formula from file
     */
    @Override
    public void action() {
        try {
            prover.saveTree(file.getPath());
            System.out.println("saved in file: " + file.getPath());
        } catch (IOException ex) {
            String message="exception "+ex.getMessage();
            EXCEPTIONLOGGER.finest(message);
            JOptionPane.showMessageDialog(this, "Problem occurred\n"+ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
}
